package com.circle.interests.biz.enums;

import lombok.Getter;

/**
 * @author zhou
 * @date 2021/1/15
 */
public enum PrizeCategoryEnum {
    /**
     * 奖品发放编码
     */
    WEIXIN_RED_PACKAGE(1L, "微信红包"),
    PHONE_FEE(2L, "话费"),
    HONG_LIAN(3L, "鸿联虚拟奖品"),
    SHAN_HU(4L, "珊瑚会员"),
    MATERIAL(5L, "实物");

    @Getter
    private final Long code;
    @Getter
    private final String info;

    PrizeCategoryEnum(Long code, String info) {
        this.code = code;
        this.info = info;
    }

    public static PrizeCategoryEnum getByCode(Long code) {
        return getByCode(code, null);
    }

    public static PrizeCategoryEnum getByCode(Long code, PrizeCategoryEnum defaultValue) {
        for (PrizeCategoryEnum e : PrizeCategoryEnum.values()) {
            if (e.code.equals(code)) {
                return e;
            }
        }
        return defaultValue;
    }
}
